package com.jrwd.recycletest.util;

import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;

/**
 * 相信自己，创造未来
 *
 * @author 小兵
 * @date 2017/10/21
 */

public class ToastUtils {


    public static boolean isShow = true;

    /**
     * 短时间显示Toast
     *
     * @param context
     * @param message
     */
    public static void showShort(Context context, int message)
    {
        if (isShow){
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
        }
    }

    /**
     * 短时间显示Toast
     *
     * @param context
     * @param message
     */
    public static void showShort(Context context, String message)
    {
        if (isShow){
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
        }
    }

    /**
     * 中部显示
     * @param context
     * @param meassage
     * @param duration
     */
    public static void showCenter(Context context, String meassage, int duration){
        if(isShow){
            Toast toast =   Toast.makeText(context,meassage,duration);
            toast.setGravity(Gravity.CENTER,0,0);
            toast.show();
        }

    }
}
